package com.sunrise.xdoc.view.catalog;

import org.springframework.stereotype.Repository;

import com.sunrise.xdoc.entity.catalog.SanPham;
import com.sunrise.xdoc.view.AbstractListDataModel;

@Repository
public class SanPhamDataModel extends AbstractListDataModel<SanPham> {
	private static final long serialVersionUID = -7459202917266236778L;

	// //////////////////////////// Filters ///////////////////////////
	public void setNameFilter(String name) {
		filters.put("name", name);
	}

	public String getNameFilter() {
		return (String) filters.get("name");
	}

	public void setLoaiSpIdFilter(Long loaiSpId) {
		// JSP change null to 0 for Number type, so reset it as null for the
		// correct filter
		filters.put("loaiSP.id", loaiSpId == 0L ? null : loaiSpId);
	}

	public Long getLoaiSpIdFilter() {
		return (Long) filters.get("loaiSP.id");
	}
}
